/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package memory;

import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;
import javax.swing.ImageIcon;

/**
 *
 * @author DAM110
 */
public class PanelImagen extends javax.swing.JPanel{
    
    private Image imagen;

    public PanelImagen(String path) {
        
        URL recurso = this.getClass().getResource(path);
        if(recurso != null){
            imagen = new ImageIcon(recurso).getImage();
        }
        
    }
    @Override
    public void paintComponent(Graphics g){
        if(imagen != null){
            
            g.drawImage(imagen, 0, 0, getWidth(), getHeight(),this);
            setOpaque(false);
            super.paintComponent(g);
        }
    }
}
